CVE-2023-35169
php-imap vulnerable to RCE through a directory traversal vulnerability
Description
PHP-IMAP is a wrapper for common IMAP communication without the need to have the php-imap module installed / enabled. Prior to version 5.3.0, an unsanitized attachment filename allows any unauthenticated user to leverage a directory traversal vulnerability, which results in a remote code execution vulnerability. Every application that stores attachments with `Attachment::save()` without providing a `$filename` or passing unsanitized user input is affected by this attack. An attacker can send an email with a malicious attachment to the inbox, which gets crawled with `webklex/php-imap` or `webklex/laravel-imap`. Prerequisite for the vulnerability is that the script stores the attachments without providing a `$filename`, or providing an unsanitized `$filename`, in `src/Attachment::save(string $path, string $filename = null)`. In this case, where no `$filename` gets passed into the `Attachment::save()` method, the package would use a series of unsanitized and insecure input values from the mail as fallback. Even if a developer passes a `$filename` into the `Attachment::save()` method, e.g. by passing the name or filename of the mail attachment itself (from email headers), the input values never get sanitized by the package. There is also no restriction about the file extension (e.g. ".php") or the contents of a file. This allows an attacker to upload malicious code of any type and content at any location where the underlying user has write permissions. The attacker can also overwrite existing files and inject malicious code into files that, e.g. get executed by the system via cron or requests. Version 5.3.0 contains a patch for this issue.
INFO
Published Date :
June 23, 2023, 9:15 p.m.
Last Modified :
Nov. 21, 2024, 8:08 a.m.
Remotely Exploit :
Yes !
Source :
[email protected]
CVSS Scores
Score | Version | Severity | Vector | Exploitability Score | Impact Score | Source |
---|---|---|---|---|---|---|
CVSS 3.1 | CRITICAL | [email protected] | ||||
CVSS 3.1 | CRITICAL | [email protected] |
Solution
- Upgrade webklex/php-imap to version 5.3.0 or later.
References to Advisories, Solutions, and Tools
Here, you will find a curated list of external links that provide in-depth
information, practical solutions, and valuable tools related to
CVE-2023-35169
.
CWE - Common Weakness Enumeration
While CVE identifies
specific instances of vulnerabilities, CWE categorizes the common flaws or
weaknesses that can lead to vulnerabilities. CVE-2023-35169
is
associated with the following CWEs:
Common Attack Pattern Enumeration and Classification (CAPEC)
Common Attack Pattern Enumeration and Classification
(CAPEC)
stores attack patterns, which are descriptions of the common attributes and
approaches employed by adversaries to exploit the CVE-2023-35169
weaknesses.
We scan GitHub repositories to detect new proof-of-concept exploits. Following list is a collection of public exploits and proof-of-concepts, which have been published on GitHub (sorted by the most recently updated).
Results are limited to the first 15 repositories due to potential performance issues.
The following list is the news that have been mention
CVE-2023-35169
vulnerability anywhere in the article.
The following table lists the changes that have been made to the
CVE-2023-35169
vulnerability over time.
Vulnerability history details can be useful for understanding the evolution of a vulnerability, and for identifying the most recent changes that may impact the vulnerability's severity, exploitability, or other characteristics.
-
CVE Modified by af854a3a-2127-422b-91ae-364da2661108
Nov. 21, 2024
Action Type Old Value New Value Added Reference https://github.com/Webklex/php-imap/blob/5.2.0/src/Attachment.php#L251-L255 Added Reference https://github.com/Webklex/php-imap/blob/5.2.0/src/Attachment.php#L252 Added Reference https://github.com/Webklex/php-imap/pull/414 Added Reference https://github.com/Webklex/php-imap/releases/tag/5.3.0 Added Reference https://github.com/Webklex/php-imap/security/advisories/GHSA-47p7-xfcc-4pv9 -
CVE Modified by [email protected]
May. 14, 2024
Action Type Old Value New Value -
Initial Analysis by [email protected]
Jul. 06, 2023
Action Type Old Value New Value Added CVSS V3.1 NIST AV:N/AC:L/PR:N/UI:N/S:U/C:H/I:H/A:H Changed Reference Type https://github.com/Webklex/php-imap/blob/5.2.0/src/Attachment.php#L251-L255 No Types Assigned https://github.com/Webklex/php-imap/blob/5.2.0/src/Attachment.php#L251-L255 Product Changed Reference Type https://github.com/Webklex/php-imap/blob/5.2.0/src/Attachment.php#L252 No Types Assigned https://github.com/Webklex/php-imap/blob/5.2.0/src/Attachment.php#L252 Product Changed Reference Type https://github.com/Webklex/php-imap/pull/414 No Types Assigned https://github.com/Webklex/php-imap/pull/414 Patch Changed Reference Type https://github.com/Webklex/php-imap/releases/tag/5.3.0 No Types Assigned https://github.com/Webklex/php-imap/releases/tag/5.3.0 Release Notes Changed Reference Type https://github.com/Webklex/php-imap/security/advisories/GHSA-47p7-xfcc-4pv9 No Types Assigned https://github.com/Webklex/php-imap/security/advisories/GHSA-47p7-xfcc-4pv9 Exploit, Vendor Advisory Added CPE Configuration OR *cpe:2.3:a:webklex:php-imap:*:*:*:*:*:*:*:* versions up to (excluding) 5.3.0
Vulnerability Scoring Details
Base CVSS Score: 9.8
Exploit Prediction
EPSS is a daily estimate of the probability of exploitation activity being observed over the next 30 days.
4.72 }} -0.30%
score
0.88743
percentile